import time

from selenium.webdriver.common.by import By

from base.base import Base
class Page(Base):
    # 定位值
    username=(By.ID,"username")
    password=(By.ID,'password')
    login=(By.XPATH,'//*[@id="loginForm"]/button')
    testdy=(By.XPATH,'/html/body/div/h1')
    shangchuan=(By.ID,'uploadFile')
    # 封装
    def username_id(self):
        self.send_keys(self.username,"13485456209")
    def password_id(self):
        self.send_keys(self.password,"1234555uuu")
    def login_xpath(self):
        self.click(self.login)
    def testduanyan(self):
        return self.duanyan(self.testdy)
    def shang(self):
        self.send_keys(self.shangchuan,r"C:\Users\Administrator\Desktop\Screenshot_7.png")
    def alst(self):
        self.alert()
    def fengzhuang(self):
        print(self.testduanyan())
        assert self.testduanyan()=="图书管理系统"
        time.sleep(2)
        self.username_id()
        time.sleep(2)
        self.password_id()
        time.sleep(2)
        self.login_xpath()
        time.sleep(2)
        self.alst()
        time.sleep(2)
        self.shang()
        time.sleep(10)


